.class public Ldgb/f0;
.super Ldgb/bp;
.source "SourceFile"


# instance fields
.field private final f:Ldgb/g0;


# direct methods
.method constructor <init>(Landroid/content/Context;Ldgb/i0;Ldgb/g0;)V
    .locals 0
    .param p1    # Landroid/content/Context;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p3    # Ldgb/g0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 1
    invoke-direct {p0, p1, p2}, Ldgb/bp;-><init>(Landroid/content/Context;Ldgb/i0;)V

    .line 2
    iput-object p3, p0, Ldgb/f0;->f:Ldgb/g0;

    return-void
.end method

.method private a(I)I
    .locals 2

    .line 103
    sget-boolean v0, Ldgb/o0;->b:Z

    if-eqz v0, :cond_0

    .line 104
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Download failed for other responses:"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    :cond_0
    const/16 p1, 0x9

    return p1
.end method

.method private a(Ldgb/i0;)I
    .locals 2
    .param p1    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 54
    iget-object p1, p1, Ldgb/i0;->f:Ljava/io/File;

    if-eqz p1, :cond_0

    .line 55
    invoke-virtual {p1}, Ljava/io/File;->delete()Z

    move-result p1

    .line 56
    sget-boolean v0, Ldgb/o0;->c:Z

    if-eqz v0, :cond_0

    .line 57
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Obsoleted file deleted, start a new file, removed:"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 58
    :cond_0
    iget-object p1, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string v0, "het"

    const-string v1, ""

    invoke-interface {p1, v0, v1}, Ldgb/h0;->a(Ljava/lang/String;Ljava/lang/String;)Z

    const/4 p1, 0x7

    return p1
.end method

.method private a(Ldgb/i0;Ldgb/g0;Ljava/io/InputStream;Ljava/io/OutputStream;)I
    .locals 16
    .param p1    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/g0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p3    # Ljava/io/InputStream;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p4    # Ljava/io/OutputStream;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move-object/from16 v2, p2

    const/16 v3, 0x1000

    new-array v3, v3, [B

    const-wide/16 v4, 0x0

    move-wide v6, v4

    .line 59
    :cond_0
    iget-wide v8, v1, Ldgb/i0;->c:J

    const/16 v10, 0x1ec

    cmp-long v11, v8, v4

    if-lez v11, :cond_2

    iget-wide v11, v0, Ldgb/bp;->e:J

    cmp-long v13, v11, v8

    if-lez v13, :cond_2

    iget-object v8, v1, Ldgb/i0;->f:Ljava/io/File;

    if-eqz v8, :cond_2

    .line 60
    sget-boolean v1, Ldgb/o0;->c:Z

    if-eqz v1, :cond_1

    const-string v1, "File size exceeds"

    .line 61
    invoke-static {v1}, Ldgb/s0;->b(Ljava/lang/String;)V

    :cond_1
    return v10

    :cond_2
    const/4 v8, 0x7

    move-object/from16 v9, p3

    .line 62
    :try_start_0
    invoke-virtual {v9, v3}, Ljava/io/InputStream;->read([B)I

    move-result v11
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    const/4 v12, -0x1

    if-ne v11, v12, :cond_4

    .line 63
    invoke-direct {v0, v1, v6, v7}, Ldgb/f0;->a(Ldgb/i0;J)Z

    move-result v3

    if-nez v3, :cond_3

    return v10

    .line 64
    :cond_3
    iget-object v3, v0, Ldgb/bp;->a:Landroid/content/Context;

    iget-object v4, v0, Ldgb/bp;->b:Ldgb/i0;

    iget-wide v4, v4, Ldgb/i0;->c:J

    invoke-interface {v2, v3, v1, v4, v5}, Ldgb/g0;->b(Landroid/content/Context;Ldgb/i0;J)V

    const/4 v1, 0x1

    return v1

    .line 65
    :cond_4
    iget-wide v12, v0, Ldgb/bp;->e:J

    int-to-long v14, v11

    add-long/2addr v12, v14

    iput-wide v12, v0, Ldgb/bp;->e:J

    add-long/2addr v6, v14

    const/4 v12, 0x0

    move-object/from16 v13, p4

    .line 66
    :try_start_1
    invoke-virtual {v13, v3, v12, v11}, Ljava/io/OutputStream;->write([BII)V

    .line 67
    invoke-virtual/range {p4 .. p4}, Ljava/io/OutputStream;->flush()V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    .line 68
    iget-object v8, v0, Ldgb/bp;->a:Landroid/content/Context;

    iget-wide v10, v0, Ldgb/bp;->e:J

    invoke-interface {v2, v8, v1, v10, v11}, Ldgb/g0;->b(Landroid/content/Context;Ldgb/i0;J)V

    .line 69
    invoke-direct/range {p0 .. p0}, Ldgb/f0;->c()Z

    move-result v8

    if-eqz v8, :cond_0

    const/16 v1, 0x258

    return v1

    :catch_0
    nop

    .line 70
    iget-object v1, v0, Ldgb/bp;->b:Ldgb/i0;

    iget-object v1, v1, Ldgb/i0;->f:Ljava/io/File;

    if-eqz v1, :cond_5

    .line 71
    invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ldgb/f0;->b(Ljava/lang/String;)Ljava/io/File;

    move-result-object v1

    .line 72
    invoke-static {v1}, Ldgb/x0;->b(Ljava/io/File;)J

    move-result-wide v1

    cmp-long v3, v1, v14

    if-gez v3, :cond_5

    return v10

    :catch_1
    :cond_5
    return v8
.end method

.method private a(Ldgb/i0;Ljava/lang/String;)I
    .locals 3
    .param p1    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ljava/lang/String;
        .annotation build Landroidx/annotation/Nullable;
        .end annotation
    .end param

    .line 107
    iget-object v0, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string v1, "het"

    invoke-interface {v0, v1}, Ldgb/h0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 108
    iget-object v2, p0, Ldgb/bp;->c:Ldgb/h0;

    invoke-interface {v2, v1, p2}, Ldgb/h0;->a(Ljava/lang/String;Ljava/lang/String;)Z

    .line 109
    invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    const/4 v2, 0x1

    if-nez v1, :cond_4

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_0

    goto :goto_0

    .line 110
    :cond_0
    invoke-virtual {v0, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_4

    .line 111
    sget-boolean v0, Ldgb/o0;->b:Z

    if-eqz v0, :cond_1

    .line 112
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "header="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p2

    invoke-static {p2}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 113
    :cond_1
    sget-boolean p2, Ldgb/o0;->c:Z

    if-eqz p2, :cond_2

    const-string p2, "Service resouce has changed, download cannot be resumed"

    .line 114
    invoke-static {p2}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 115
    :cond_2
    iget-object p1, p1, Ldgb/i0;->f:Ljava/io/File;

    if-eqz p1, :cond_3

    .line 116
    invoke-virtual {p1}, Ljava/io/File;->delete()Z

    :cond_3
    const/4 p1, 0x7

    return p1

    :cond_4
    :goto_0
    return v2
.end method

.method private a(Ljava/net/HttpURLConnection;)I
    .locals 0
    .param p1    # Ljava/net/HttpURLConnection;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 105
    sget-boolean p1, Ldgb/o0;->b:Z

    if-eqz p1, :cond_0

    const-string p1, "Got HTTP response code 503"

    .line 106
    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    :cond_0
    const/4 p1, 0x7

    return p1
.end method

.method private a(Ljava/net/HttpURLConnection;Ldgb/i0;)I
    .locals 9
    .param p1    # Ljava/net/HttpURLConnection;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 79
    sget-boolean v0, Ldgb/o0;->b:Z

    if-eqz v0, :cond_0

    const-string v0, "readResponseHeaders"

    .line 80
    invoke-static {v0}, Ldgb/s0;->b(Ljava/lang/String;)V

    :cond_0
    const-string v0, "Content-Disposition"

    .line 81
    invoke-virtual {p1, v0}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string v2, ""

    if-nez v1, :cond_1

    move-object v0, v2

    goto :goto_0

    .line 82
    :cond_1
    invoke-virtual {p1, v0}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :goto_0
    const-string v1, "Content-Location"

    .line 83
    invoke-virtual {p1, v1}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_2

    move-object v1, v2

    goto :goto_1

    .line 84
    :cond_2
    invoke-virtual {p1, v1}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    :goto_1
    const-string v3, "ETag"

    .line 85
    invoke-virtual {p1, v3}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    if-nez v4, :cond_3

    move-object v3, v2

    goto :goto_2

    :cond_3
    invoke-virtual {p1, v3}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 86
    :goto_2
    invoke-direct {p0, p2, v3}, Ldgb/f0;->a(Ldgb/i0;Ljava/lang/String;)I

    move-result v3

    const/4 v4, 0x1

    if-eq v3, v4, :cond_4

    return v3

    :cond_4
    const-string v3, "Transfer-Encoding"

    .line 87
    invoke-virtual {p1, v3}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    const-string v5, "hcl"

    if-nez v3, :cond_6

    .line 88
    iget-object v6, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string v7, "Content-Length"

    .line 89
    invoke-virtual {p1, v7}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v8

    if-nez v8, :cond_5

    goto :goto_3

    .line 90
    :cond_5
    invoke-virtual {p1, v7}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 91
    :goto_3
    invoke-interface {v6, v5, v2}, Ldgb/h0;->a(Ljava/lang/String;Ljava/lang/String;)Z

    goto :goto_4

    .line 92
    :cond_6
    sget-boolean p1, Ldgb/o0;->c:Z

    if-eqz p1, :cond_7

    const-string p1, "ignoring content-length because of xfer-encoding"

    .line 93
    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 94
    :cond_7
    :goto_4
    sget-boolean p1, Ldgb/o0;->c:Z

    if-eqz p1, :cond_8

    .line 95
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Content-Disposition: "

    invoke-virtual {p1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 96
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Content-Length: "

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v0, p0, Ldgb/bp;->c:Ldgb/h0;

    invoke-interface {v0, v5}, Ldgb/h0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 97
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Content-Location: "

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 98
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Target File: "

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object p2, p2, Ldgb/i0;->f:Ljava/io/File;

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 99
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string p2, "ETag: "

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object p2, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string v0, "het"

    invoke-interface {p2, v0}, Ldgb/h0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 100
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string p2, "Transfer-Encoding: "

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 101
    :cond_8
    iget-object p1, p0, Ldgb/bp;->c:Ldgb/h0;

    invoke-interface {p1, v5}, Ldgb/h0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result p1

    if-eqz p1, :cond_a

    if-eqz v3, :cond_9

    const-string p1, "chunked"

    .line 102
    invoke-virtual {v3, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result p1

    if-nez p1, :cond_a

    :cond_9
    const/4 p1, 0x1

    goto :goto_5

    :cond_a
    const/4 p1, 0x0

    :goto_5
    if-eqz p1, :cond_b

    const/16 p1, 0x1ec

    return p1

    :cond_b
    return v4
.end method

.method private a(Ljava/net/HttpURLConnection;Ldgb/i0;Ldgb/g0;)I
    .locals 5
    .param p1    # Ljava/net/HttpURLConnection;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p3    # Ldgb/g0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 42
    invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getResponseCode()I

    move-result v0

    .line 43
    sget-boolean v1, Ldgb/o0;->b:Z

    if-eqz v1, :cond_0

    .line 44
    iget-object v1, p0, Ldgb/bp;->c:Ldgb/h0;

    const/4 v2, 0x3

    const-string v3, "nf"

    invoke-interface {v1, v3, v2}, Ldgb/h0;->b(Ljava/lang/String;I)I

    move-result v1

    .line 45
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "received response for "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getURL()Ljava/net/URL;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string v3, " statusCode="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v3, " retryTime="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 46
    :cond_0
    iget-object v1, p0, Ldgb/bp;->c:Ldgb/h0;

    invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getLastModified()J

    move-result-wide v2

    const-string v4, "tln"

    invoke-interface {v1, v4, v2, v3}, Ldgb/h0;->a(Ljava/lang/String;J)Z

    const/16 v1, 0xc8

    if-eq v0, v1, :cond_7

    const/16 v1, 0xce

    if-ne v0, v1, :cond_1

    goto :goto_2

    :cond_1
    const/16 p3, 0x1f7

    if-ne v0, p3, :cond_2

    .line 47
    invoke-direct {p0, p1}, Ldgb/f0;->a(Ljava/net/HttpURLConnection;)I

    move-result p1

    return p1

    :cond_2
    const/16 p3, 0x12d

    if-eq v0, p3, :cond_6

    const/16 p3, 0x12e

    if-eq v0, p3, :cond_6

    const/16 p3, 0x12f

    if-eq v0, p3, :cond_6

    const/16 p3, 0x133

    if-ne v0, p3, :cond_3

    goto :goto_1

    :cond_3
    const/16 p1, 0x1a0

    if-eq v0, p1, :cond_5

    const/16 p1, 0x19c

    if-ne v0, p1, :cond_4

    .line 48
    iget-object p1, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string p3, "het"

    .line 49
    invoke-interface {p1, p3}, Ldgb/h0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result p1

    if-nez p1, :cond_4

    goto :goto_0

    .line 50
    :cond_4
    invoke-direct {p0, v0}, Ldgb/f0;->a(I)I

    move-result p1

    return p1

    .line 51
    :cond_5
    :goto_0
    invoke-direct {p0, p2}, Ldgb/f0;->a(Ldgb/i0;)I

    move-result p1

    return p1

    .line 52
    :cond_6
    :goto_1
    invoke-direct {p0, p1, p2}, Ldgb/f0;->b(Ljava/net/HttpURLConnection;Ldgb/i0;)I

    move-result p1

    return p1

    .line 53
    :cond_7
    :goto_2
    invoke-direct {p0, p1, p2, p3}, Ldgb/f0;->b(Ljava/net/HttpURLConnection;Ldgb/i0;Ldgb/g0;)I

    move-result p1

    return p1
.end method

.method private a(Ldgb/i0;Ldgb/g0;)V
    .locals 5
    .param p1    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/g0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ldgb/bp$a;,
            Ldgb/bp$c;
        }
    .end annotation

    const-string v0, "HttpURLConnection connect failed"

    .line 20
    invoke-direct {p0}, Ldgb/f0;->c()Z

    move-result v1

    if-nez v1, :cond_b

    .line 21
    sget-boolean v1, Ldgb/o0;->b:Z

    if-eqz v1, :cond_0

    .line 22
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "start download "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ldgb/i0;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 23
    :cond_0
    invoke-static {}, Ldgb/t0;->b()Z

    move-result v1

    if-eqz v1, :cond_a

    .line 24
    invoke-direct {p0, p1}, Ldgb/f0;->b(Ldgb/i0;)I

    move-result v1

    const/16 v2, 0xa

    if-eq v1, v2, :cond_9

    const/4 v2, 0x1

    if-ne v1, v2, :cond_6

    const/4 v1, 0x0

    .line 25
    :try_start_0
    iget-object v3, p0, Ldgb/bp;->a:Landroid/content/Context;

    const/4 v4, 0x0

    invoke-virtual {p0, v3, p1, v4}, Ldgb/bp;->a(Landroid/content/Context;Ldgb/i0;Z)Ljava/net/HttpURLConnection;

    move-result-object v1

    .line 26
    invoke-virtual {v1}, Ljava/net/HttpURLConnection;->connect()V

    .line 27
    invoke-direct {p0, v1, p1, p2}, Ldgb/f0;->a(Ljava/net/HttpURLConnection;Ldgb/i0;Ldgb/g0;)I

    move-result p1
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v1, :cond_1

    .line 28
    invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V

    :cond_1
    move v1, p1

    goto :goto_0

    :catchall_0
    move-exception p1

    .line 29
    :try_start_1
    sget-boolean p2, Ldgb/o0;->b:Z

    if-eqz p2, :cond_2

    .line 30
    invoke-static {v0, p1}, Ldgb/s0;->b(Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    :cond_2
    const/16 p1, 0x1eb

    if-eqz v1, :cond_3

    .line 31
    invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V

    :cond_3
    const/16 v1, 0x1eb

    goto :goto_0

    :catch_0
    move-exception p1

    .line 32
    :try_start_2
    sget-boolean p2, Ldgb/o0;->b:Z

    if-eqz p2, :cond_4

    .line 33
    invoke-static {v0, p1}, Ldgb/s0;->b(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 34
    :cond_4
    new-instance p1, Ldgb/bp$c;

    invoke-direct {p1, p0}, Ldgb/bp$c;-><init>(Ldgb/bp;)V

    throw p1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    :catchall_1
    move-exception p1

    if-eqz v1, :cond_5

    .line 35
    invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V

    :cond_5
    throw p1

    :cond_6
    :goto_0
    if-eq v1, v2, :cond_8

    const/4 p1, 0x7

    if-ne v1, p1, :cond_7

    .line 36
    new-instance p1, Ldgb/bp$c;

    invoke-direct {p1, p0}, Ldgb/bp$c;-><init>(Ldgb/bp;)V

    throw p1

    .line 37
    :cond_7
    new-instance p1, Ldgb/bp$a;

    const-string p2, "target file error"

    invoke-direct {p1, v1, p2}, Ldgb/bp$a;-><init>(ILjava/lang/String;)V

    throw p1

    :cond_8
    return-void

    .line 38
    :cond_9
    new-instance p1, Ldgb/bp$a;

    const/16 p2, 0xc8

    const-string v0, "Download already finished"

    invoke-direct {p1, p2, v0}, Ldgb/bp$a;-><init>(ILjava/lang/String;)V

    throw p1

    .line 39
    :cond_a
    new-instance p1, Ldgb/bp$a;

    const/16 p2, 0xc3

    const-string v0, "no allow network"

    invoke-direct {p1, p2, v0}, Ldgb/bp$a;-><init>(ILjava/lang/String;)V

    throw p1

    .line 40
    :cond_b
    iget-object p1, p0, Ldgb/bp;->b:Ldgb/i0;

    const/16 p2, 0x258

    iput p2, p1, Ldgb/i0;->a:I

    .line 41
    new-instance p1, Ldgb/bp$a;

    iget-object p2, p0, Ldgb/bp;->b:Ldgb/i0;

    iget p2, p2, Ldgb/i0;->a:I

    const-string v0, " task stop"

    invoke-direct {p1, p2, v0}, Ldgb/bp$a;-><init>(ILjava/lang/String;)V

    throw p1
.end method

.method private a(Ldgb/i0;J)Z
    .locals 8
    .param p1    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 73
    iget-object v0, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string v1, "hcl"

    invoke-interface {v0, v1}, Ldgb/h0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 74
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    const/4 v2, 0x0

    const/4 v3, 0x1

    if-nez v1, :cond_0

    .line 75
    invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v1

    int-to-long v4, v1

    cmp-long v1, p2, v4

    if-nez v1, :cond_1

    :cond_0
    iget-wide v4, p1, Ldgb/i0;->c:J

    const-wide/16 v6, 0x0

    cmp-long v1, v4, v6

    if-lez v1, :cond_2

    iget-wide v6, p0, Ldgb/bp;->e:J

    cmp-long v1, v4, v6

    if-eqz v1, :cond_2

    :cond_1
    const/4 v1, 0x1

    goto :goto_0

    :cond_2
    const/4 v1, 0x0

    .line 76
    :goto_0
    sget-boolean v4, Ldgb/o0;->c:Z

    if-eqz v4, :cond_3

    .line 77
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "handle end of stream, excepted size:"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v0, ", byte transferred this time:"

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v4, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string p2, ", totalBytes:"

    invoke-virtual {v4, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide p2, p1, Ldgb/i0;->c:J

    invoke-virtual {v4, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string p2, ", bytesSoFar:"

    invoke-virtual {v4, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide p2, p0, Ldgb/bp;->e:J

    invoke-virtual {v4, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string p2, ", matches:"

    invoke-virtual {v4, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    xor-int/lit8 p2, v1, 0x1

    invoke-virtual {v4, p2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p2

    invoke-static {p2}, Ldgb/s0;->b(Ljava/lang/String;)V

    :cond_3
    if-eqz v1, :cond_4

    .line 78
    iget-object p1, p1, Ldgb/i0;->f:Ljava/io/File;

    if-nez p1, :cond_5

    :cond_4
    const/4 v2, 0x1

    :cond_5
    return v2
.end method

.method private b(Ldgb/i0;)I
    .locals 8
    .param p1    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 51
    iget-object v0, p1, Ldgb/i0;->f:Ljava/io/File;

    const/4 v1, 0x1

    if-nez v0, :cond_0

    return v1

    .line 52
    :cond_0
    iget-wide v2, p1, Ldgb/i0;->c:J

    const-wide/16 v4, 0x0

    const/16 v6, 0x1ec

    cmp-long v7, v2, v4

    if-gtz v7, :cond_1

    return v6

    .line 53
    :cond_1
    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Ldgb/bp;->a(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    return v6

    .line 54
    :cond_2
    iget-object v0, p1, Ldgb/i0;->f:Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v0

    if-eqz v0, :cond_7

    .line 55
    iget-object v0, p1, Ldgb/i0;->f:Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->length()J

    move-result-wide v2

    cmp-long v0, v2, v4

    if-nez v0, :cond_4

    .line 56
    sget-boolean v0, Ldgb/o0;->c:Z

    if-eqz v0, :cond_3

    const-string v0, "Obsoleted file deleted"

    .line 57
    invoke-static {v0}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 58
    :cond_3
    iget-object p1, p1, Ldgb/i0;->f:Ljava/io/File;

    invoke-virtual {p1}, Ljava/io/File;->delete()Z

    goto :goto_0

    .line 59
    :cond_4
    sget-boolean p1, Ldgb/o0;->c:Z

    if-eqz p1, :cond_5

    .line 60
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "Download resumed from:"

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 61
    :cond_5
    iget-object p1, p0, Ldgb/bp;->b:Ldgb/i0;

    iget-wide v4, p1, Ldgb/i0;->c:J

    cmp-long p1, v2, v4

    if-nez p1, :cond_6

    const/16 p1, 0xa

    return p1

    .line 62
    :cond_6
    iput-wide v2, p0, Ldgb/bp;->e:J

    goto :goto_0

    .line 63
    :cond_7
    iget-object p1, p1, Ldgb/i0;->f:Ljava/io/File;

    invoke-virtual {p1}, Ljava/io/File;->getParentFile()Ljava/io/File;

    move-result-object p1

    if-eqz p1, :cond_8

    .line 64
    invoke-static {p1}, Ldgb/x0;->a(Ljava/io/File;)Z

    move-result p1

    if-nez p1, :cond_8

    return v6

    :cond_8
    :goto_0
    return v1
.end method

.method private b(Ljava/net/HttpURLConnection;Ldgb/i0;)I
    .locals 5
    .param p1    # Ljava/net/HttpURLConnection;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 41
    iget-object v0, p0, Ldgb/bp;->c:Ldgb/h0;

    const/4 v1, 0x5

    const-string v2, "rc"

    invoke-interface {v0, v2, v1}, Ldgb/h0;->b(Ljava/lang/String;I)I

    move-result v0

    if-lt v0, v1, :cond_0

    const/16 p1, 0x8

    return p1

    :cond_0
    const-string v1, "Location"

    .line 42
    invoke-virtual {p1, v1}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    const/4 v1, 0x7

    if-nez p1, :cond_1

    return v1

    .line 43
    :cond_1
    sget-boolean v3, Ldgb/o0;->c:Z

    if-eqz v3, :cond_2

    .line 44
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Location :"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ldgb/s0;->b(Ljava/lang/String;)V

    .line 45
    :cond_2
    :try_start_0
    new-instance v3, Ljava/net/URI;

    iget-object v4, p0, Ldgb/bp;->b:Ldgb/i0;

    iget-object v4, v4, Ldgb/i0;->e:Ljava/lang/String;

    invoke-direct {v3, v4}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    new-instance v4, Ljava/net/URI;

    invoke-direct {v4, p1}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v4}, Ljava/net/URI;->resolve(Ljava/net/URI;)Ljava/net/URI;

    move-result-object v3

    .line 46
    invoke-virtual {v3}, Ljava/net/URI;->toString()Ljava/lang/String;

    move-result-object v3

    iput-object v3, p2, Ldgb/i0;->g:Ljava/lang/String;
    :try_end_0
    .catch Ljava/net/URISyntaxException; {:try_start_0 .. :try_end_0} :catch_0

    .line 47
    iget-object p1, p0, Ldgb/bp;->c:Ldgb/h0;

    add-int/lit8 v0, v0, 0x1

    invoke-interface {p1, v2, v0}, Ldgb/h0;->a(Ljava/lang/String;I)Z

    return v1

    :catch_0
    nop

    .line 48
    sget-boolean v0, Ldgb/o0;->c:Z

    if-eqz v0, :cond_3

    .line 49
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Couldn\'t resolve redirect URI "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p1, " for "

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object p1, p0, Ldgb/bp;->b:Ldgb/i0;

    iget-object p1, p1, Ldgb/i0;->e:Ljava/lang/String;

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {p1}, Ldgb/s0;->c(Ljava/lang/String;)V

    :cond_3
    const/4 p1, 0x0

    .line 50
    iput-object p1, p2, Ldgb/i0;->g:Ljava/lang/String;

    const/16 p1, 0x9

    return p1
.end method

.method private b(Ljava/net/HttpURLConnection;Ldgb/i0;Ldgb/g0;)I
    .locals 6
    .param p1    # Ljava/net/HttpURLConnection;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p2    # Ldgb/i0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param
    .param p3    # Ldgb/g0;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 4
    invoke-direct {p0, p1, p2}, Ldgb/f0;->a(Ljava/net/HttpURLConnection;Ldgb/i0;)I

    move-result v0

    const/4 v1, 0x1

    if-eq v0, v1, :cond_0

    return v0

    .line 5
    :cond_0
    iget-object v0, p2, Ldgb/i0;->i:Ljava/util/List;

    if-eqz v0, :cond_1

    iget-object v2, p2, Ldgb/i0;->j:Ljava/util/Map;

    if-eqz v2, :cond_1

    .line 6
    invoke-virtual {p0, p1, v0, v2}, Ldgb/bp;->a(Ljava/net/HttpURLConnection;Ljava/util/List;Ljava/util/Map;)V

    .line 7
    :cond_1
    invoke-direct {p0}, Ldgb/f0;->c()Z

    move-result v0

    if-eqz v0, :cond_2

    const/16 p1, 0x258

    return p1

    .line 8
    :cond_2
    iget-object v0, p0, Ldgb/bp;->a:Landroid/content/Context;

    iget-wide v2, p0, Ldgb/bp;->e:J

    invoke-interface {p3, v0, p2, v2, v3}, Ldgb/g0;->a(Landroid/content/Context;Ldgb/i0;J)V

    .line 9
    iget-object v0, p2, Ldgb/i0;->f:Ljava/io/File;

    if-eqz v0, :cond_4

    .line 10
    :try_start_0
    new-instance v0, Ljava/io/FileOutputStream;

    iget-object v2, p2, Ldgb/i0;->f:Ljava/io/File;

    invoke-direct {v0, v2, v1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V
    :try_end_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 11
    sget-boolean p2, Ldgb/o0;->c:Z

    if-eqz p2, :cond_3

    invoke-virtual {p1}, Ljava/io/FileNotFoundException;->printStackTrace()V

    :cond_3
    const/16 p1, 0x1ec

    return p1

    .line 12
    :cond_4
    new-instance v0, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V

    .line 13
    :goto_0
    invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getContentEncoding()Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x7

    const/4 v4, 0x0

    .line 14
    :try_start_1
    invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object p1
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    if-nez p1, :cond_5

    .line 15
    invoke-static {v0}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    .line 16
    invoke-static {p1}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    return v3

    :cond_5
    if-eqz v2, :cond_6

    :try_start_2
    const-string v5, "gzip"

    .line 17
    invoke-virtual {v2, v5}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v5

    if-eqz v5, :cond_6

    .line 18
    new-instance v2, Ljava/util/zip/GZIPInputStream;

    invoke-direct {v2, p1}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;)V

    :goto_1
    move-object p1, v2

    goto :goto_2

    :catchall_0
    move-exception p2

    move-object v4, p1

    goto :goto_4

    :catch_1
    move-object v4, p1

    goto :goto_5

    :cond_6
    if-eqz v2, :cond_7

    const-string v5, "deflate"

    .line 19
    invoke-virtual {v2, v5}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v2

    if-eqz v2, :cond_7

    .line 20
    new-instance v2, Ljava/util/zip/InflaterInputStream;

    invoke-direct {v2, p1}, Ljava/util/zip/InflaterInputStream;-><init>(Ljava/io/InputStream;)V

    goto :goto_1

    .line 21
    :cond_7
    :goto_2
    invoke-direct {p0, p2, p3, p1, v0}, Ldgb/f0;->a(Ldgb/i0;Ldgb/g0;Ljava/io/InputStream;Ljava/io/OutputStream;)I

    move-result v2
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 22
    invoke-static {v0}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    .line 23
    invoke-static {p1}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    if-ne v2, v1, :cond_9

    const/16 p1, 0xc8

    .line 24
    iput p1, p2, Ldgb/i0;->a:I

    .line 25
    invoke-virtual {p0}, Ldgb/f0;->b()V

    .line 26
    iget-object p1, p2, Ldgb/i0;->f:Ljava/io/File;

    if-eqz p1, :cond_8

    .line 27
    iget-object p1, p0, Ldgb/bp;->a:Landroid/content/Context;

    invoke-interface {p3, p1, p2, v4}, Ldgb/g0;->a(Landroid/content/Context;Ldgb/i0;[B)V

    goto :goto_3

    .line 28
    :cond_8
    iget-object p1, p0, Ldgb/bp;->a:Landroid/content/Context;

    check-cast v0, Ljava/io/ByteArrayOutputStream;

    .line 29
    invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v0

    .line 30
    invoke-interface {p3, p1, p2, v0}, Ldgb/g0;->a(Landroid/content/Context;Ldgb/i0;[B)V

    .line 31
    :goto_3
    iget-object p1, p0, Ldgb/bp;->c:Ldgb/h0;

    iget-object p2, p2, Ldgb/i0;->e:Ljava/lang/String;

    invoke-static {p2}, Ldgb/r0;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    invoke-interface {p1, p2}, Ldgb/h0;->c(Ljava/lang/String;)V

    :cond_9
    return v2

    :catchall_1
    move-exception p2

    .line 32
    :goto_4
    invoke-static {v0}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    .line 33
    invoke-static {v4}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    throw p2

    .line 34
    :catch_2
    :goto_5
    invoke-static {v0}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    .line 35
    invoke-static {v4}, Ldgb/x0;->a(Ljava/io/Closeable;)V

    return v3
.end method

.method private b(Ljava/lang/String;)Ljava/io/File;
    .locals 3
    .param p1    # Ljava/lang/String;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 36
    invoke-static {}, Landroid/os/Environment;->getDownloadCacheDirectory()Ljava/io/File;

    move-result-object v0

    .line 37
    invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    return-object v0

    .line 38
    :cond_0
    invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File;

    move-result-object v0

    .line 39
    invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_1

    return-object v0

    .line 40
    :cond_1
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Cannot determine filesystem root for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method private c()Z
    .locals 3

    .line 1
    iget-object v0, p0, Ldgb/bp;->b:Ldgb/i0;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Ldgb/bp;->b:Ldgb/i0;

    iget v1, v1, Ldgb/i0;->d:I

    const/4 v2, 0x2

    if-ne v1, v2, :cond_0

    const/4 v1, 0x1

    goto :goto_0

    :cond_0
    const/4 v1, 0x0

    :goto_0
    monitor-exit v0

    return v1

    :catchall_0
    move-exception v1

    .line 3
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method


# virtual methods
.method protected a()V
    .locals 6

    .line 1
    iget-object v0, p0, Ldgb/bp;->c:Ldgb/h0;

    const-string v1, "nf"

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Ldgb/h0;->a(Ljava/lang/String;I)Z

    :catch_0
    :goto_0
    const/4 v0, 0x0

    .line 2
    :try_start_0
    iget-object v2, p0, Ldgb/bp;->b:Ldgb/i0;

    iget-object v3, p0, Ldgb/f0;->f:Ldgb/g0;

    invoke-direct {p0, v2, v3}, Ldgb/f0;->a(Ldgb/i0;Ldgb/g0;)V
    :try_end_0
    .catch Ldgb/bp$c; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ldgb/bp$a; {:try_start_0 .. :try_end_0} :catch_1

    goto :goto_2

    :catch_1
    move-exception v1

    .line 3
    sget-boolean v2, Ldgb/o0;->b:Z

    if-eqz v2, :cond_0

    .line 4
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Download Failed "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ldgb/bp$a;->b()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2, v1}, Ldgb/s0;->b(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 5
    :cond_0
    iget-object v2, p0, Ldgb/bp;->b:Ldgb/i0;

    invoke-virtual {v1}, Ldgb/bp$a;->a()I

    move-result v3

    iput v3, v2, Ldgb/i0;->a:I

    .line 6
    invoke-virtual {v1}, Ldgb/bp$a;->a()I

    move-result v1

    const/16 v2, 0x1ec

    if-eq v1, v2, :cond_1

    goto :goto_1

    .line 7
    :cond_1
    iget-object v1, p0, Ldgb/bp;->b:Ldgb/i0;

    iget-object v1, v1, Ldgb/i0;->f:Ljava/io/File;

    if-eqz v1, :cond_2

    .line 8
    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    .line 9
    :cond_2
    :goto_1
    invoke-virtual {p0}, Ldgb/f0;->b()V

    .line 10
    iget-object v1, p0, Ldgb/f0;->f:Ldgb/g0;

    iget-object v2, p0, Ldgb/bp;->a:Landroid/content/Context;

    iget-object v3, p0, Ldgb/bp;->b:Ldgb/i0;

    invoke-interface {v1, v2, v3, v0}, Ldgb/g0;->a(Landroid/content/Context;Ldgb/i0;[B)V

    goto :goto_2

    :catch_2
    move-exception v2

    .line 11
    iget-object v3, p0, Ldgb/bp;->c:Ldgb/h0;

    const/4 v4, 0x3

    invoke-interface {v3, v1, v4}, Ldgb/h0;->b(Ljava/lang/String;I)I

    move-result v3

    if-lt v3, v4, :cond_3

    .line 12
    iget-object v1, p0, Ldgb/bp;->b:Ldgb/i0;

    const/16 v2, 0x1f1

    iput v2, v1, Ldgb/i0;->a:I

    .line 13
    invoke-virtual {p0}, Ldgb/f0;->b()V

    .line 14
    iget-object v1, p0, Ldgb/f0;->f:Ldgb/g0;

    iget-object v2, p0, Ldgb/bp;->a:Landroid/content/Context;

    iget-object v3, p0, Ldgb/bp;->b:Ldgb/i0;

    invoke-interface {v1, v2, v3, v0}, Ldgb/g0;->a(Landroid/content/Context;Ldgb/i0;[B)V

    :goto_2
    return-void

    .line 15
    :cond_3
    invoke-virtual {v2}, Ldgb/bp$c;->a()I

    move-result v0

    .line 16
    iget-object v4, p0, Ldgb/bp;->c:Ldgb/h0;

    add-int/lit8 v5, v3, 0x1

    invoke-interface {v4, v1, v5}, Ldgb/h0;->a(Ljava/lang/String;I)Z

    .line 17
    sget-boolean v4, Ldgb/o0;->b:Z

    if-eqz v4, :cond_4

    .line 18
    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Retry Download "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v3, " times"

    invoke-virtual {v4, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3, v2}, Ldgb/s0;->b(Ljava/lang/String;Ljava/lang/Throwable;)V

    :cond_4
    int-to-long v2, v0

    .line 19
    :try_start_1
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_1
    .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_0

    goto/16 :goto_0
.end method

.method public b()V
    .locals 3

    .line 1
    iget-object v0, p0, Ldgb/bp;->b:Ldgb/i0;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Ldgb/bp;->b:Ldgb/i0;

    const/4 v2, 0x2

    iput v2, v1, Ldgb/i0;->d:I

    .line 3
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method
